<?php
$ip=$_SERVER['REMOTE_ADDR'];
$aa=findCityByIp($ip);
var_dump($aa);

function findCityByIp($ip){
    $data = file_get_contents('http://ip.taobao.com/service/getIpInfo.php?ip='.$ip);
    return json_decode($data,$assoc=true);
}